#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define D long double
#define N 20004
#define lbt(x) (x&(-x))
int a[N],len,n,pos[N];
vector<int> p;
int ta[N];
inline void chag(int x,int v){
	while(x<=20000){
		ta[x]+=v;x+=lbt(x);
	}
}
inline int ask(int x){
	int sum=0;
	while(x){
		sum+=ta[x];x-=lbt(x);
	}
	return sum;
}
inline void getto(int x,int en){
	if(x<en){
		for(int i=x;i<en;i++){
			swap(a[i],a[i+1]);p.push_back(i);
		}
	}else{
		for(int i=x;i>en;i--){
			swap(a[i-1],a[i]);p.push_back(i-1);
		}
	}
}
void dcsort(int l,int r){
	if(l==r)	return;
	int mid=(l+r)>>1;
	dcsort(l,mid);dcsort(mid+1,r);
	int j=mid+1;int pos=l;
	while(pos<j&&j<=r){
		while(j<=r&&a[j]<a[pos])	getto(j,pos),pos++,j++;
		pos++;
	}
}
signed main(){
	freopen("rotate.in","r",stdin);
	freopen("rotate.out","w",stdout);
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;len=2;int cnt=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];cnt+=ask(20000)-ask(a[i]);chag(a[i],1);
	}
	if(cnt<=1900000){
		int zt=1;
		while(zt){
			zt=0;
			for(int i=1;i<n;i++)if(a[i]>a[i+1]){
				p.push_back(i);swap(a[i],a[i+1]);zt=1;
			}
		}
	}else{
		dcsort(1,n);
	}
	cout<<len<<" "<<p.size()<<"\n";
	for(int i=0;i<p.size();i++){
		cout<<1<<" "<<p[i]<<"\n";
	}
	return 0;
}
/*#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define D long double
#define N 20004
int a[N],len,n,pos[N];
vector<int> p;
inline void getmov(int x){
	for(int i=x;i<x+len-1;i++){
		pos[a[i+1]]--;pos[a[i]]++;
		swap(a[i],a[i+1]);
	}
}
inline void getmov2(int x,int num){
	vector<int> v1,v2;
	for(int i=x;i<=x+num-1;i++)	v1.push_back(a[i]);
	for(int i=x+num;i<=x+len-1;i++)	v2.push_back(a[i]);
	for(int i=x;i<=x+v2.size()-1;i++)	a[i]=v2[i-x];
	for(int i=x+v2.size();i<=x+len-1;i++)	a[i]=v1[i-x-v2.size()];
}
inline void mov(int x){
	if(x==pos[x])	return;
	int now=pos[x];
	while(now+len-1<=x){
		getmov(now);p.push_back(now);
		now+=len-1;
	}
	if(now==x)	return;
	if(now+len-1>n){
		
	}else{
		getmov2()
	}
}
signed main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;len=ceil(sqrt(n));
	for(int i=1;i<=n;i++)	cin>>a[i],pos[i]=i;
	for(int i=1;i<=len;i++){
		if(i==pos[i])	continue;
		for(int j=pos[i];j>i;j--)	getmov(j-1),p.push_back(j-1);
	}
	for(int i=n;i>=len+1;i--){
		mov(i);
	}
	cout<<len<<" "<<p.size()<<"\n";
	for(int i=0;i<p.size();i++){
		cout<<1<<" "<<p[i]<<"\n";
	}
	return 0;
}*/

